import {ajax,noToken} from './ajax';
//import ajax from '../utils/request';
const BASE = 'http://47.104.167.113:8081';  
// const BASE = 'http://192.168.0.130:8088';  


// 登录、注册、新增用户   
export const reqLogin = (userMobile,userPassword) => ajax(BASE + '/doLogin',{userMobile,userPassword},'POST');  
export const reqSignin = (org_id,user_email,user_mobile,user_name,user_password) => ajax(BASE + '/user/register',{org_id,user_email,user_mobile,user_name,user_password},'POST');
export const reqOrganListNoToken = () => noToken(BASE + '/user/organization/find/all');   // 获取所有组织(无Token):注册时用 
export const reqSiginAskList = (org_id) => ajax(BASE + '/user/find/organizationId/processed',{org_id},'POST');   // 根据 组织id 获取 该组织的未处理注册请求
export const reqIsAgreeSigin = (user_mobile,org_id,user_passed) => ajax(BASE + '/user/approval',{user_mobile,org_id,user_passed},'POST');  // 是否同意注册
export const refreshHomeInfo = ()=> ajax(BASE+'/home/refreshHomeInfo','','POST')
//export const reqOrgInfoByOrgid = (org_id,org_pid) => ajax(BASE + '/organization/find/organizationId',{org_id,org_pid},'POST');    // 根据组织id获取组织信息，暂时没有用!!!

// 用户管理
export const reqOrganListByParentOrgid1 = (org_pid) => ajax(BASE + '/user/organization/find/parentId',{org_pid},'POST');  // 通过 父组织id 查找 所有子组织1
export const reqOrgSearch = (org_id) => ajax(BASE + '/user/find/organizationId',{org_id},'POST');  // 根据组织id查找用户
export const reqNameSearch = (user_name,org_id) => ajax(BASE + '/user/find/name',{user_name,org_id},'POST');  // 根据 用户姓名 模糊查找用户
export const reqMobileSearch = (user_mobile,org_id) => ajax(BASE + '/user/find/mobile',{user_mobile,org_id},'POST');  // 根据 手机号 查找用户
export const reqEditUserInfor = (user_mobile,user_name,user_email,user_remark,org_id,user_roles) => ajax(BASE + '/user/update',{user_mobile,user_name,user_email,user_remark,org_id,user_roles},'POST'); // 编辑用户信息
export const reqDeleteUser = (user_mobile,org_id) => ajax(BASE + '/user/delete',{user_mobile,org_id},'POST');  // 删除用户
export const reqLockedConfirm = (user_mobile,org_id,user_locked) => ajax(BASE + '/user/locked',{user_mobile,org_id,user_locked},'POST');  // 锁定用户
export const reqEnableConfirm = (user_mobile,org_id,user_enabled) => ajax(BASE + '/user/enabled',{user_mobile,org_id,user_enabled},'POST');  // 启用用户

// 组织管理
export const reqOrganListByParentOrgid = (org_pid) => ajax(BASE + '/organization/find/parentId',{org_pid},'POST');   // 通过 父组织id 查找 所有子组织（普通管理员查找权限所有组织、查看子组织）
export const reqOrgNameSearch = (org_pid,org_name) => ajax(BASE + '/organization/find/organizationName',{org_pid,org_name},'POST');  // 通过 组织名称 模糊查找组织
export const reqAddOrgInfor = (org_pid,org_name,org_contact,org_address,org_remark,org_province) => ajax(BASE + '/organization/create',{org_pid,org_name,org_contact,org_address,org_remark,org_province},'POST');   // 创建组织
export const reqEditOrgInfor = (org_id,org_pid,org_name,org_contact,org_address,org_remark) => ajax(BASE + '/organization/update',{org_id,org_pid,org_name,org_contact,org_address,org_remark},'POST');  // 编辑组织
export const reqDeleteOrg = (org_id,org_pid) => ajax(BASE + '/organization/delete',{org_id,org_pid},'POST');  // 删除组织

// 工区管理
export const reqOrganListByParentOrgid2 = (org_pid) => ajax(BASE + '/workSpace/organization/find/parentId',{org_pid},'POST');  // 通过 父组织id 查找 所有子组织1
export const reqWorkshopSearchByOrgid = (ws_pid) => ajax(BASE + '/workSpace/find/parentId',{ws_pid},'POST');   //根据 组织id 获取所有工区(普通管理员获取所有工区/根据组织搜索工区)
export const reqWorkshopSearchByName = (ws_pid,ws_name) => ajax(BASE + '/workSpace/find/workSpaceName',{ws_pid,ws_name},'POST');  // 根据 工区名称 模糊查找工区
export const reqAddWorkshopInfor = (ws_name,ws_pid,ws_contact,ws_address,ws_remark) => ajax(BASE + '/workSpace/create',{ws_name,ws_pid,ws_contact,ws_address,ws_remark},'POST');  // 创建工区
export const reqEditWorkshopInfor = (ws_id,ws_name,ws_pid,ws_contact,ws_address,ws_remark) => ajax(BASE + '/workSpace/update',{ws_id,ws_name,ws_pid,ws_contact,ws_address,ws_remark},'POST'); // 编辑工区
export const reqDeleteWorkshop = (ws_id,ws_pid) => ajax(BASE + '/workSpace/delete',{ws_id,ws_pid},'POST');  // 删除工区

export const reqWorkUserList = (ws_id,ws_pid) => ajax(BASE + '/workSpace/user/find/workSpaceId',{ws_id,ws_pid},'POST');  // 根据 工区id 获取 工区内的所有用户
export const reqOrgUserByName = (user_name,ws_id,ws_pid) => ajax(BASE + '/workSpace/user/find/parent/name',{user_name,ws_id,ws_pid},'POST');  // 根据 用户姓名 查找 组织内的用户  
export const reqOrgUserByMobile = (user_mobile,ws_id,ws_pid) => ajax(BASE + '/workSpace/user/find/parent/mobile',{user_mobile,ws_id,ws_pid},'POST');  // 根据 用户手机号 获取 组织内的用户 
export const reqOrgUserByWspid = (ws_id,ws_pid) => ajax(BASE + '/workSpace/user/find/parent',{ws_id,ws_pid},'POST');  // 根据 工区pid 获取 组织内的用户 
export const reqTransferWorkUser = (add,userTransferStandards,ws_id,ws_pid) => ajax(BASE + '/workSpace/user/transfer',{add,userTransferStandards,ws_id,ws_pid},'POST');  // 将工区内的用户调入、调出
export const reqWorkUserSearchByName = (user_name,ws_id,ws_pid) => ajax(BASE + '/workSpace/user/find/name',{user_name,ws_id,ws_pid},'POST'); // 根据用户名称模糊查找用户

// 权限管理
export const reqRoleList = () => ajax(BASE + '/role/find/all');  // 获取所有角色列表
export const reqDeleteRole = (role_id) => ajax(BASE + '/role/delete1',{role_id},'POST');  // 删除角色
export const reqMenusList = () => ajax(BASE + '/menu/find/all');  // 获取所有菜单
export const reqAddRoleInfor = (role_name,role_name_Zh,role_remark,role_menus) => ajax(BASE + '/role/create1',{role_name,role_name_Zh,role_remark,role_menus},'POST');  // 创建角色
export const reqEditRoleAuth = (role_id,role_name,role_name_Zh,role_remark,role_menus) => ajax(BASE + '/role/update1',{role_id,role_name,role_name_Zh,role_remark,role_menus},'POST'); // 编辑角色

// 数据管理
export const reqOrganListByParentOrgid_1 = (org_pid) => ajax(BASE + '/data/management/organization/find/parentId',{org_pid},'POST');  // 通过 父组织id 查找 所有子组织1
export const reqWorkshopSearchByOrgid1 = (ws_pid) => ajax(BASE + '/data/management/workSpace/find/parentId',{ws_pid},'POST');   //根据 组织id 获取所有工区(普通管理员获取所有工区/根据组织搜索工区)
export const reqWorkshopSearchByName1 = (ws_pid,ws_name) => ajax(BASE + '/data/management/workSpace/find/workSpaceName',{ws_pid,ws_name},'POST');  // 根据 工区名称 模糊查找工区
export const reqDrillListByWsId = (drill_ws_id,drill_org_id) => ajax(BASE + '/drill/find/parentId',{drill_ws_id,drill_org_id},'POST');    // 根据工区id（井pid）获取所有井
export const reqDrillIdSearch = (drill_id,drill_ws_id,drill_org_id) => ajax(BASE + '/drill/find/drillId',{drill_id,drill_ws_id,drill_org_id},'POST');   // 根据井id查找井
export const reqAddDrill = (drill_id,drill_ws_id,drill_org_id,drill_address,drill_contact,drill_remark) => ajax(BASE + '/drill/create',{drill_id,drill_ws_id,drill_org_id,drill_address,drill_contact,drill_remark},'POST');  // 新建测井
export const reqEditDrill = (drill_id,drill_ws_id,drill_org_id,drill_address,drill_contact,drill_remark) => ajax(BASE + '/drill/update',{drill_id,drill_ws_id,drill_org_id,drill_address,drill_contact,drill_remark},'POST');  // 编辑测井信息
export const reqDeleteDrill = (drill_id,drill_ws_id,drill_org_id) => ajax(BASE + '/drill/delete',{drill_id,drill_ws_id,drill_org_id},'POST');  // 删除测井
export const reqDataFileListById = (drill_id,org_id,ws_id) => ajax(BASE + '/data/management/document/find/drillId',{drill_id,org_id,ws_id},'POST');   // 根据井id获取所有文件信息
export const reqDocNameSearch = (drill_id,org_id,ws_id,doc_name) => ajax(BASE + '/data/management/document/find/name',{drill_id,org_id,ws_id,doc_name},'POST');  // 根据文件名称查找文件
export const reqEditDocInfo = (doc_id,drill_id,org_id,ws_id,start_depth,end_depth,measuring_time,measuring_address,casing_depth,operator,remark) => ajax(BASE + '/data/management/document/update',{doc_id,drill_id,org_id,ws_id,start_depth,end_depth,measuring_time,measuring_address,casing_depth,operator,remark},'POST');  // 编辑文件信息
export const reqDeleteDoc = (doc_id,drill_id,org_id,ws_id) => ajax(BASE + '/data/management/document/delete',{doc_id,drill_id,org_id,ws_id},'POST');  // 删除文件

// 数据处理
export const reqProcessOrgList = (org_pid) => ajax(BASE + '/data/process/organization/find/parentId',{org_pid},'POST');  // 1根据 父组织id（用户的组织id）获取组织列表  
export const reqProcessWsList = (ws_pid) => ajax(BASE + '/data/process/workSpace/find/parentId',{ws_pid},'POST');  // 1根据组织id(父工区id)获取所有工区
export const reqProcessDrillList = (drill_org_id,drill_ws_id) => ajax(BASE + '/data/process/drill/find/parentId',{drill_org_id,drill_ws_id},'POST');  // 1根据工区id（井pid）获取所有井
export const reqProcessDocList = (drill_id,org_id,ws_id) => ajax(BASE + '/data/process/document/find/parentId',{drill_id,org_id,ws_id},'POST');  // 1根据井id获取所有文件列表

export const reqProcessCurveList = (doc_id,doc_type,drill_id,org_id,ws_id) => ajax(BASE + '/data/process/curve/find/document',{doc_id,doc_type,drill_id,org_id,ws_id},'POST');  // 1根据文件id获取所有曲线列表
export const reqProcessDocDataList = (doc_id,doc_type,drill_id,org_id,ws_id) => ajax(BASE + '/data/process/document/find/id',{doc_id,doc_type,drill_id,org_id,ws_id},'POST');  // 1根据文件id获取 纯数据文件
// export const reqProcessDrawDataList = (doc_id) => ajax(BASE + '/data/process/document/find/id',{doc_id},'POST');  // 根据文件id获取 绘图文件
export const reqAllMb = () => ajax(BASE + '/template/find/all');   //1 获取所有模板列表
export const reqProcessMbData = (mb_id) => ajax(BASE + '/template/find/templateId',{mb_id},'POST');   // 1根据模板id获取模板
export const reqDeleteMb = (mb_id) => ajax(BASE + '/template/delete',{mb_id},'POST');  // 1删除模板 
export const reqResizeMbName = (mb_id,mb_name) => ajax(BASE + '/template/rename',{mb_id,mb_name},'POST'); //1 模板重命名
export const reqGetDefaultMb = (user_mobile) => ajax(BASE + '/template/user/default/find/mobile',{user_mobile},'POST');  // 1获取用户默认模板  
export const reqSaveDefaultMb = (user_mobile,mb_id) => ajax(BASE + '/template/user/default/save',{user_mobile,mb_id},'POST');  // 1保存用户默认模板（待测）???????????????
export const reqSaveData = (saveType,pureDataDocument) => ajax(BASE + '/data/process/pure/save',{saveType,pureDataDocument},'POST');  // 保存纯数据文件
export const reqSaveDataMb = (saveType,drawDocument) => ajax(BASE + '/data/process/draw/save',{saveType,drawDocument},'POST');  // 保存 绘图文件
export const reqSaveMb = (saveType,mb_id,mb_name,mb_dao) => ajax(BASE + '/template/save',{saveType,mb_id,mb_name,mb_dao},'POST');  // 1保存 模板
export const reqAllYxTypes = () => ajax(BASE + '/rock/find/all');  //1  获取所有岩性类型
export const reqCurvesSplice = (curveFirst,curveSecond,spliceDepth) => ajax(BASE + '/curve/splicing',{curveFirst,curveSecond,spliceDepth},'POST');  // 曲线拼接
export const reqCurvesTranslation = (curves,yData,depthMove) => ajax(BASE + '/curve/shift',{curves,yData,depthMove},'POST');  // 曲线平移
export const reqCurvesFilter = (curves,yData,depthStart,depthEnd,weight) => ajax(BASE + '/curve/filter',{curves,yData,depthStart,depthEnd,weight},'POST');  // 曲线滤波

export const reqCurvesPull = (doc_id,curves,start_depth,end_depth) => ajax(BASE + '/',{doc_id,curves,start_depth,end_depth},'POST');  // 曲线拉伸
export const reqCurvesCompress = (doc_id,curves,start_depth,end_depth) => ajax(BASE + '/',{doc_id,curves,start_depth,end_depth},'POST');  // 曲线压缩
export const reqAllVideoList = () => ajax(BASE + '/');  //  获取所有视频列表   xxxxxxxxxxxxxxxxxxxxxxxxxxx 
export const reqVideoUrlSrtById = (url) => ajax(BASE + '/video/find/url',{url},'POST');  // 根据视频id获取 
export const reqVideoBarById = (video_id) => ajax(BASE + '/',{video_id},'POST');  // 根据视频id获取 视频柱状图
export const reqDocDataByBiaotou = (docData) => ajax(BASE + '/data/process/pure/calculate',docData,'POST');  // 修改表头信息，重新计算数据   XXXX

// 数据展示
export const reqProcessDocList2 = (drill_id,org_id,ws_id) => ajax(BASE + '/pure/document/find/parentId',{drill_id,org_id,ws_id},'POST');  // 1根据井id获取所有文件列表
// 原始数据展示
export const reqProcessDocList1 = (drill_id,org_id,ws_id) => ajax(BASE + '/originalDocument/find/parentId',{drill_id,org_id,ws_id},'POST');  // 1根据井id获取所有原始文件列表
export const reqgetOrigindata=(ws_id,org_id,drill_id,doc_id)=>ajax(BASE+'/originalDocument/find/id',{ws_id,org_id,drill_id,doc_id},'POST');//获取原始文件数据
export const reqSaveOrigindata=(data_set,doc_id,drill_id,org_id,ws_id)=>ajax(BASE+'/originalDocument/update',{data_set,doc_id,drill_id,org_id,ws_id},'POST')//保存原始文件save是保存，another_save是另存为

//首页数据加载
export const getHomeInfo=(id)=>ajax(BASE+'/home/getHomeInfo',{org_id:id},'POST')
export const getChinaMapInfo=()=>ajax(BASE+'/home/getChinaMapInfo',{},'GET')